package top.yaofengqiao.springcloudsimple.demo.biz.trigger.http.app;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.yaofengqiao.springcloudsimple.common.util.R;
import top.yaofengqiao.springcloudsimple.demo.biz.domain.order.service.IOrderService;
import top.yaofengqiao.springcloudsimple.demo.biz.trigger.http.app.dto.CreateOrderDTO;
import top.yaofengqiao.springcloudsimple.web.starter.util.OauthUtil;

import javax.annotation.Resource;

/**
 * @author yfq
 * @date 2024/6/14 11:35
 * @description
 */
@RestController
@RequestMapping("/appOrder")
public class AppOrderController {
    @Resource
    private IOrderService orderService;

    /**
     * 创建订单
     */
    @PostMapping("/createOrder")
    public R<Long> createOrder(@RequestBody @Validated CreateOrderDTO createOrderDTO) {
        return R.ok(orderService.createOrder(createOrderDTO, OauthUtil.currentUserId()));
    }
}
